package com.expdatacloud.controller.iqc;

import com.expdatacloud.dto.ApiResponse;
import com.expdatacloud.entity.InspectionPlanMgt;
import com.expdatacloud.service.InspectionPlanMgtService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * 检验项目方案管理表 前端控制器
 * @author jie
 * @date 2019/11/20 -11:28
 */
@Controller
@RequestMapping("/inspectionPlanMgt")
public class InspectionPlanMgtController {

    @Autowired
    private InspectionPlanMgtService inspectionPlanMgtService;

    /**
     * 根据checkProjectKey 查询 sampleKey
     *
     */
    @GetMapping("/getInspectionPlanMgt")
    @ResponseBody
    public ApiResponse getInspectionPlanMgt(String checkScenarioName, HttpServletRequest request) {
        try {
            InspectionPlanMgt inspectionPlanMgt = new InspectionPlanMgt();
            inspectionPlanMgt.setCheckScenarioName(checkScenarioName);
            return ApiResponse.ok(inspectionPlanMgtService.get(inspectionPlanMgt));
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResponse.error(e.getMessage());
        }
    }
}
